/*!
    \file  BF7006AMxx_config.h
    \brief peripherals configuration for BF7006AMxx
*/

/*
    Copyright (C) 2017 Byd

    2021-02-28, V1.0.0, peripherals configuration for BF7006AMxx
    2021-06-30, V1.0.1, 1. add return value for all config function
                        2. can init struct update
    2021-09-01, V1.0.2, 1. fixed a bug that the return value of overall stays 
                           error if a peripheral is not selected to initialize
                        2. add function system_config(), it is the same as the old
                           version of SystemInit(), and user can configure within
                           this file.
    2022-09-01, V1.0.3, 1. modify the value of SCI single mode
                        2. modify the maximun of CAN single id mask
*/

#ifndef BF7006AMxx_CONFIG_H
#define BF7006AMxx_CONFIG_H

#include "RTE_Components.h"
#include "BF7006AMxx.h"
#include "BF7006AMxx_sysctrl.h"

#ifdef BF7x06AMxx_SCI_DRIVER_PRESENT
    #include "BF7006AMxx_sci.h"
#endif

#ifdef BF7x06AMxx_CAN_DRIVER_PRESENT
    #include "BF7006AMxx_can.h"
#endif

#ifdef BF7x06AMxx_ADC_DRIVER_PRESENT
    #include "BF7006AMxx_adc.h"
#endif

#ifdef BF7x06AMxx_WDT_DRIVER_PRESENT
    #include "BF7006AMxx_wdt.h"
#endif

#ifdef BF7x06AMxx_TIMER_DRIVER_PRESENT
    #include "BF7006AMxx_timer.h"
#endif

#ifdef BF7x06AMxx_RTC_DRIVER_PRESENT
    #include "BF7006AMxx_rtc.h"
#endif

#ifdef BF7x06AMxx_PWM_DRIVER_PRESENT
    #include "BF7006AMxx_pwm.h"
#endif

#ifdef BF7x06AMxx_GPIO_DRIVER_PRESENT
    #include "BF7006AMxx_gpio.h"
#endif

#ifdef BF7x06AMxx_EFLASH_DRIVER_PRESENT
    #include "BF7006AMxx_eflash.h"
#endif

/* peripherals_config return status */
typedef struct{
#ifdef BF7x06AMxx_SCI_DRIVER_PRESENT
    ErrorStatus sci;
#endif
#ifdef BF7x06AMxx_CAN_DRIVER_PRESENT
    ErrorStatus can;
#endif
#ifdef BF7x06AMxx_ADC_DRIVER_PRESENT
    ErrorStatus adc;
#endif
#ifdef BF7x06AMxx_WDT_DRIVER_PRESENT
    ErrorStatus wdt;
#endif
#ifdef BF7x06AMxx_TIMER_DRIVER_PRESENT
    ErrorStatus timer;
#endif
#ifdef BF7x06AMxx_RTC_DRIVER_PRESENT
    ErrorStatus rtc;
#endif
#ifdef BF7x06AMxx_PWM_DRIVER_PRESENT
    ErrorStatus pwm;
#endif
#ifdef BF7x06AMxx_GPIO_DRIVER_PRESENT
    ErrorStatus gpio;
#endif
    ErrorStatus overall;        /* a single error would set this var error during initialization */
}config_return_status;


/* call this function to initialize all selected peripherals */
config_return_status peripherals_config(void);

/* call this function to initialize system resources */
void system_config(void);

/* call the following functions to configure single peripheral */
ErrorStatus adc_config(void);
ErrorStatus sci_config(void);
ErrorStatus can_config(void);
ErrorStatus timer_config(void);
ErrorStatus pwm_config(void);
ErrorStatus wdt_cfg(void);
ErrorStatus rtc_config(void);
ErrorStatus gpio_config(void);

#endif
